<template>
	<!-- 城市回收站登录 -->
	<view class="cityRecycleLogin" :style="'height:'+windowHeight+'rpx;'">
		<view class="cityRecycleLogin-main">
			<view class="avatarImg">
				<image src="https://huishou.68699.cn/attachment/images/2/uploads/20240229/bedfdfcc15c319d73cea46b233de786f.png" mode=""></image>
			</view>
			<view class="cityRecycleLogin-input">
				<view class="user userName">
					<view class="icon iconfont icon-yonghu"></view>
					<input type="text" v-model="userinfo.user" placeholder="请输入账号" placeholder-style="font-size:27rpx;color:#c5c5c5;" />
				</view>
				<view class="user passWord">
					<view class="icon iconfont icon-mima"></view>
					<input type="password" v-model="userinfo.pass" placeholder="请输入密码"  placeholder-style="font-size:27rpx;color:#c5c5c5;"/>
				</view>
				<view class="loginIn" @tap="incityRecycle">登录</view>
			</view>
		</view>
	</view>
</template>

<script>
	import util from '@/component/commen/api/util.js';//引入封装的请求
	export default {
		data() {
			return {
				windowHeight:"",//当前屏幕高度
				userinfo:{
					user:"",//用户名
					pass:"",//密码
				}
			};
		},
		onShow() {
			let sysInfo = uni.getSystemInfoSync()
			let scaleFactor = 750 / sysInfo.windowWidth
			this.windowHeight = sysInfo.windowHeight * scaleFactor
			if(uni.getStorageSync("packAccount")){
				this.userinfo = JSON.parse(uni.getStorageSync("packAccount"))
			}
		},
		methods:{
			incityRecycle(){//点击登录
				// console.log(this.userinfo)
				if(this.userinfo.user==""){
					return uni.showToast({
						title:"请输入账号!",
						icon:"none"
					})
				}else if(this.userinfo.pass==""){
					return uni.showToast({
						title:"请输入密码!",
						icon:"none"
					})
				}
				var obj = {
				    do:"pack",
				    op:"login",
				}
				var params = {...obj,...this.userinfo}
				util.requestWithSign(params).then(res=>{
					if(res.errno!=0){
						return uni.showToast({
							title:res.message,
							icon:"none"
						})
					}
					uni.setStorageSync("packAccount",JSON.stringify(this.userinfo))
					uni.setStorageSync("packid",res.data)//回收站id
					uni.navigateTo({
						url:"/otherPages/cityRecycle/cityRecycle"
					})
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.cityRecycleLogin{
	width: 100%;
	background: url("https://huishou.68699.cn/attachment/images/2/uploads/20240318/230e9e533062bc9976289e01775bc7e5.jpg");
	background-size: 130%;
	.cityRecycleLogin-main{
		width: 85%;
		height: 500rpx;
		background: #fff;
		border-radius: 30rpx;
		position: absolute;
		top: 295rpx;
		right: 55rpx;
		.avatarImg{
			margin: 0 auto;
			margin-top: -80rpx;
			width: 150rpx;
			height: 150rpx;
			image{
				width: 100%;
				border-radius: 50%;
				height: 100%;
			}
		}
		.cityRecycleLogin-input{
			padding: 0 40rpx;
			box-sizing: border-box;
			margin-top: 30rpx;
			.user{
				display: flex;
				margin-top: 45rpx;
				background: #f9f9f9;
				border-radius: 10rpx;
				padding: 10rpx;
				align-items: center;
				box-sizing: border-box;
				.icon{
					font-size: 53rpx;
					margin-right: 20rpx;
				}
			}
			.loginIn{
				padding:20rpx 0;
				margin-top: 50rpx;
				background: #00b388;
				text-align: center;
				border-radius: 10rpx;
				font-size: 32rpx;
				color: #fff;
			}
		}
	}
}
</style>
